package com.tac.common.result;

import lombok.Data;

@Data
public class Result<T> {

    private String msg;
    private Integer cod;
    private T data;

    public static <T> Result<T> success(T data,String msg){
        Result<T> result = new Result<>();
        result.msg=msg;
        result.cod=200;
        result.data=data;
        return result;
    }
    public static <T> Result<T> success(T data,String msg,Integer cod){
        Result<T> result = new Result<>();
        result.msg=msg;
        result.cod=cod;
        result.data=data;
        return result;
    }
    public static <T> Result<T> error(String msg){
        Result<T> result = new Result<>();
        result.msg=msg;
        result.cod=500;
        return result;
    }
    public static <T> Result<T> error(String msg,Integer cod){
        Result<T> result = new Result<>();
        result.msg=msg;
        result.cod=cod;
        return result;
    }
}
